package br.jus.tjpe.xml.unmarshall;

import java.io.File;
import java.io.FileNotFoundException;

import javax.xml.bind.JAXBContext;
import javax.xml.bind.JAXBElement;
import javax.xml.bind.JAXBException;
import javax.xml.bind.Unmarshaller;

import br.jus.tjpe.ws.dominio.ObjectFactory;
import br.jus.tjpe.ws.dominio.TreinamentoProperties;

public class Unmarshall {

	@SuppressWarnings("unchecked")
	public static void main(String[] args) throws JAXBException,
			FileNotFoundException {
		JAXBContext jc = JAXBContext.newInstance(ObjectFactory.class);
		// Create unmarshaller
		Unmarshaller um = jc.createUnmarshaller();

		TreinamentoProperties conf = (TreinamentoProperties) ((JAXBElement<TreinamentoProperties>) um
				.unmarshal(new File("src/main/resources/treinamento-conf.xml")))
				.getValue();

		System.out.println("configuracao1: " + conf.getConfiguracao1());
		System.out.println("configuracao2: " + conf.getConfiguracao2());
	}
}
